package sg.edu.nus.iss.club.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;

import sg.edu.nus.iss.club.Member;

public class RemoveMemberDialog extends RemoveDialog<Member> {
	
	public RemoveMemberDialog(JFrame frame) {
		super(frame);
		try {
			okButton.addActionListener(new OkButtonActionListener());
			cancelButton.addActionListener(new CancelButtonActionListener());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private class OkButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			if (deletedItem != null) {
				clubApplication.removeSelectedMember(deletedItem.getMemberNumber());
			}
			clubApplication.getMainWindow().refresh();
			setVisible(false);
		}
	}
	
	private class CancelButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
		}
	}
	
}
